%{
#include "scopes.h"
#include "findseeds.h"
%}
%import array.h
%import Array.i
%import Net.i
%import netstruct.h

%newobject combine;

%include scopes.h

%template(Scope) __scope<unsigned char>;
%template(ScopeExpansion) __scope<size_t>;
%template(State) __state<unsigned char>;

%template(sScope) sScope<unsigned char>;
%template(sScopeExpansion) sScope<size_t>;

%extend StateList{
   State* at(size_t n){
      return $self->at(n);
   }
   State* back(){
      return $self->back();
   }
   size_t size(){
      return $self->size();
   }
}
%include findseeds.h
%inline %{
void idxSort(VS* idx,SV* score,size_type nrc=-1){
   if ((long) nrc==-1) nrc=idx->size();
   VF* scr=arrayFromSV<float>(score); // function from Array.i
   if (scr->size()<nrc){
      std::cout << "error: idxSort: score array too short" << std::endl;
      return;
   }
   idxSort(idx,scr,nrc);
   delete scr;
}
void weightRand(VS* IDX, SV* weight, double beta, size_type num, size_type nrc=-1){
   if ((long) nrc==-1) nrc=IDX->size();
   VF* WGT=arrayFromSV<float>(weight);
   if (WGT->size()<nrc){
      std::cout << "error: weightRand: weight array too short" << std::endl;
      return;
   }
   weightRand(IDX, WGT, beta, num, nrc);
   delete WGT;
}
%}